<?php defined("SYSPATH") or die("No direct script access.");
/**
* @author Kami Vaniea (Carnegie Mellon University)
* @co-author Nipun Gupta (Carnegie Mellon University)
*/


class audit_log_block_Core {
 /**
 * @author Kami Vaniea
 */
 static function get_site_list() {
    return array("hello" => t("Hello"));
  }

 /**
 * @author Kami Vaniea
 */
 static function get($block_id, $theme) {
   $block = "";

   switch ($block_id) {
   	  case "hello":
		$block = new Block();
		$block->css_id = "g-rule-block";
                $block->title = t("Log Applications Block");
                $block->content = new View("audit_log_block.html");
                $block->content->dispText = "Privacy State Reminders, Editables
                
               \n1. Welcome " // For displaying the full name of the user
                .'<b>'.identity::active_user()->full_name.'</b>';
                //.$theme->item()->is_album()? t("Album info");
      
                self::audit_log_view($theme->item());
	  break;
	}

   return $block;
  }


  /**
  * @author Kami Vaniea
  */
  static function audit_log_view($item) {
	db::build()->insert("audit_logs",
		array("item_id" => $item->id,
            "user_id" =>  identity::active_user()->id,
            "action" => "view",
            "timestamp" => time()))
      ->execute();
  }

}
